package com.ma.controller;

import com.alibaba.fastjson.JSON;
import com.ma.service.customer.CustomerService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
/**
*
*
@Author: xiaoma
@Date: 09:56 2020/8/26
@Description: 获取用户信息
*/

@Controller
@CrossOrigin
@RequestMapping("/customer")
public class CustomerController {
    private CustomerService customerService;

    public CustomerController(CustomerService customerService) {
        this.customerService = customerService;
    }

    @RequestMapping("/count")
    @CrossOrigin
    @ResponseBody
    public Object queryCustomerTight(){
        System.out.println("========queryCustomerTight========");
        //结清用户人数
        Integer customerTight = customerService.queryCustomerCount();
        System.out.println(customerTight);
        HashMap<String, Object> map = new HashMap<>();
        map.put("customerTight",customerTight);
        JSON json = (JSON) JSON.toJSON(map);
        System.out.println(json);
        return json;
    }
}
